﻿#include "rxmessage.h"

RxMessage::RxMessage():DataBuffer(){

}
RxMessage::RxMessage(u8 *data, int len):DataBuffer(data, len) {
    head.command = 0xFF;
    if (len >= (int)sizeof(head)) {
        memcpy(&head, data, sizeof(head));
        skip(sizeof(head));
    }
}

RxMessage::RxMessage(RxMessage *message):DataBuffer(message){
    head.command = message->getKey();
    head.type = message->getType();
}

int RxMessage::getKey(){
    return head.command;
}
int RxMessage::getType(){
    return head.type;
}
